package com.xgkj.diyiketang.util;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.widget.Toast;

/**
 * Toast提示工具类
 * 
 * @author houmiao.xiong
 * 
 * @time 2013-10-30 下午4:52:27
 */
public class ToastUtil {

	private static Handler handler = new Handler(Looper.getMainLooper());

	/**
	 * tosat提示
	 * @param act
	 * @param msg
	 * @time 2013-10-30 下午4:52:41
	 */
	public static void showMessage(final Context act, final String msg) {
		if (act == null)return;
        showMessage(act, msg, Toast.LENGTH_SHORT);
	}

	/**
	 * toast提示
	 * @param act
	 * @param msg
	 * @time 2013-10-30 下午4:52:52
	 */
    public static void showMessage(final Context act, final int msg) {
        if (act == null) return;
        showMessage(act, msg, Toast.LENGTH_SHORT);
    }

    public static void showMessage(final Context act, final String msg, final int len) {
        handler.post(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(act, msg, len).show();
            }
        });
    }

    public static void showMessage(final Context act, final int msg, final int len) {
        handler.post(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(act, msg, len).show();
            }
        });
    }

}
